﻿var relateVals = new Object();
$(initPage);
function initPage() {
	$("#checkItemDiv").attr("scrollTop", '48');//控制DIV滚动条
	$(".checkItem", "#checkList").click(function() {
		if($(this).hasClass("selectTD")) {
			return;
		}
	});
	$("#formulaDesc").text($("#check_13", "#checkList").attr("title"));
	$("#check_13", "#checkList").addClass("selectTD").find("img").attr("src","themes/comm/images/open.gif");
	
	
	var jobStatus = $("#jobStatus").val();
	//按扭不可操作
	if (jobStatus == '-2' || jobStatus == "0") {
		$("#reCheck,#btnEdit").attr("disabled", true);//不允许再次操作
	}
	
	
	$("#reCheck").click(function() {
		$("#reCheck").attr("disabled", true);//不允许再次操作
		$.post("m/submit_file/recheck", {
			checkName:"R13",
			checkDate:$("#checkDate").val()
		}, function(data) {
			if ($.checkErrorMsg(data) ) {
				alert(data.msg.text);
				//location.reload();
				$("#reQuery").click();
			} 
		}, "json");
	});
	queryNotPassed();
	
	$("#reQuery").click(function() {
		$("#reQuery").attr("disabled", true);//不允许再次操作
		//alert($("#checkDate").val());
		$.post("m/data_check/requeryr13", {
			checkDate:$("#checkDate").val()
		}, function(data) {
			if ($.checkErrorMsg(data) ) {
				//alert(data.msg.text);
				//alert(data.checkDate);
				//alert(data.checkR13.busiDate);
				//location.reload();
				if (data.checkR13 == null){
					alert($("#checkDate").val() + "日数据还未核对");
			    } else {
				    $("#querybusiDate").text(data.checkR13.busiDate);
				    $("#querychkTypeDesc").text(data.checkR13.chkTypeDesc);
				    $("#querydiscAmtText").text(data.checkR13.discAmtText);
				    $("#queryreservesFactAmtText").text(data.checkR13.reservesFactAmtText);
				    $("#queryfullCommText").text(data.checkR13.fullCommText);
				    $("#queryaccumAdjustAmtText").text(data.checkR13.accumAdjustAmtText);
				    $("#querysdcCommAmtText").text(data.checkR13.sdcCommAmtText);
				    $("#querybankCommText").text(data.checkR13.bankCommText);
				    $("#querybankInterestText").text(data.checkR13.bankInterestText);
				    $("#queryreservesInterestText").text(data.checkR13.reservesInterestText);
				    $("#querysecInterestText").text(data.checkR13.secInterestText);
				    $("#querywithheldTaxAmtText").text(data.checkR13.withheldTaxAmtText);
				    $("#querysettleAdjustAmtText").text(data.checkR13.settleAdjustAmtText);
				    $("#queryclearOffsetBalText").text(data.checkR13.clearOffsetBalText);
				    $("#querystamptaxOffsetBalText").text(data.checkR13.stamptaxOffsetBalText);
				    $("#queryredBlueFillAmtText").text(data.checkR13.redBlueFillAmtText);
				    $("#queryother1AmtText").text(data.checkR13.other1AmtText);
				    $("#queryother2AmtText").text(data.checkR13.other2AmtText);
				    $("#queryother3AmtText").text(data.checkR13.other3AmtText);
				    $("#queryother4AmtText").text(data.checkR13.other4AmtText);
				    $("#querynote").text(data.checkR13.note);
			    }
			} 
		}, "json");
		$("#reQuery").attr("disabled", false);//不允许再次操作
	});

$("#btnHist").click(function() {
		var url = BASE_PATH + "page/datacheck/check_r13_hist.jsp?busiDate=" + $("#checkDate").val();
		window.showModalDialog(url,"","dialogWidth:800px;dialogHeight:480px;help:no;center:yes;status:no");
	});
}
function changePage(url) {
	if(parseInt(url) < 10){
		url = "0"+url;
	}
	url = "m/data_check/initr"+url;
	location.href=BASE_PATH+url;
}
function getR13FactAmt(){
	var url = BASE_PATH + "m/data_check/queryr13ChkFactAmt?factAmtDate=" + $("#checkDate").val();
	window.open(url,"","width=500, height=240,top=400, left=400,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no");
}
function getSettleAmt(dateType){
	var url = BASE_PATH + "m/data_check/querysettleAmtDetail?dateType=" + dateType + "&querySettleDate=" + $("#checkDate").val();
	window.open(url,"","width=1000, height=650,top=200, left=200,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no");
}
